//
//  VOCIndex.m
//  testapp
//
//  Created by Wallace Wu on 09-3-11.
//  Copyright 2009 Sonic Solutions. All rights reserved.
//

#import "VOCIndex.h"


@implementation VOCIndex

@synthesize indexName;
@synthesize indexRange;

-(id)initWithName:(NSString*)name withRange:(NSRange)range
{
    self = [super init];
    if(self)
    {
        self.indexName = name;
        self.indexRange = range;
    }
    return self;
}

-(id)initWithCoder:(NSCoder *)encoder
{
    self = [super init];
    if(self)
    {
        self.indexName = [encoder decodeObjectForKey:@"indexName"];
        NSRange range;
        range.location = (NSUInteger)[encoder decodeIntegerForKey:@"indexLocation"];
        range.length = (NSUInteger)[encoder decodeIntegerForKey:@"indexLength"];
        self.indexRange = range;
    }
    return self;
}

- (void)encodeWithCoder:(NSCoder *)encoder
{
    [encoder encodeObject:self.indexName forKey:@"indexName"];
    [encoder encodeInteger:(NSInteger)self.indexRange.location forKey:@"indexLocation"];
    [encoder encodeInteger:(NSInteger)self.indexRange.length forKey:@"indexLength"];
}

-(void)dealloc
{
    [indexName release];
    [super dealloc];
}

@end
